<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="../../../common/include.jsp"%>
<html>
	<head>
<jsp:include page="../../../common/head.jsp">
	 <jsp:param name="_spPage" value="true"/>
</jsp:include>
	<title>选择用户</title>
	<script language="JavaScript">  
		isModalWindow=true;
		//最大可选择用户数量
		var maxCount = '${maxCount}';
		function allSelectUser()
		{
			xjCommon.checkAll('ids');
			var str = xjCommon.getValueStr("ids",";");
			if(str!=null && str.length>0)
				parent.frame_right.add(str);
			
		}
		function onckSelectUser(ck)
		{
			if(ck.checked){
				parent.frame_right.add(ck.value);
			}else{
				parent.frame_right.delck(ck.value);
			}
		}
		
		//页面元素验证
	function select_User()
	{
		var checkObj = parent.frame_right.document.getElementById("selectUserRight");
		var len = checkObj.length;
		if(len>0)
		{
			if(maxCount!=''&&len>parseInt(maxCount))
			{
				alert("当前功能至多允许选择"+maxCount+"个用户！");
				return;
			}
			var str = ""
			for(var i=0;i<len;i++)
	   		{
				str+=checkObj[i].value+";";
	   		}
	   		if(str.length>0)
				str=str.substring(0,str.length-1);
	   		window.top.returnValue = str;
	   		window.top.close();
		}else{
			alert("请选择要添加的用户！");
			return;
		}
	}
	</script>
	</head>
	<body>
		<form action="listCommonUser.do" name="UserListForm" method="post">
			<div id="body_div">
			<w:ShowTitle name="用户选择">
			<w:TitleButton funcName="选择" onClickFunction="select_User()" urlImg="${ctx}/images/main/add.png"/>
			<w:TitleButton funcName="查询" onClickFunction="_queryDivBg(this)" urlImg="${ctx}/images/main/query.png"/>
			<w:TitleButton funcName="返回" onClickFunction="window.top.close()" urlImg="${ctx}/images/main/back.png"/>
			</w:ShowTitle>
			<div id="body_content">
				<div id="queryDiv">	
				<table width="100%" border="0">
					
					<tr>
						<td>用户ID</td>
						<td class="left_align">
							<input name="userlist.userId" type="text" id="userlist.userId" value="${userlist.userId}">
							<input name="maxCount" type="hidden" id="maxCount" value="${maxCount}">
							<input name="userIds" type="hidden" id="userIds" value="${userIds}">
						</td>
						<td>用户姓名</td>
						<td class="left_align">
							<input name="userlist.userName" type="text" id="userlist.userName" value="${userlist.userName}">
						</td>
					</tr>
					<tr>
						<td>分组标识</td>
						<td class="left_align">
							<input name="userlist.groupSign" type="text" id="userlist.groupSign" value="${userlist.groupSign}">
						</td>
						<td>移动电话</td>
						<td class="left_align">
							<input name="userlist.mobileTelephone" type="text" id="userlist.mobileTelephone" value="${userlist.mobileTelephone}">
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<input name="button" type="submit" class="btn_standard" value="　查 询　" />
							<input name="button" type="button" class="btn_standard" onclick="_cancelQuery()" value="取消" />
						</td>
					</tr>
				</table>
			</div>	
				<table width="100%" cellspacing="0" class="listTable">
					<tr>
						<td width="40" class="td_title">
							<span onClick="allSelectUser()" >全选</span>
						</td>
						<td width="80" class="td_title">用户ID</td>
						<td width="100" class="td_title">用户姓名</td>
						<td width="100" class="td_title">分组标识</td>
						<td class="td_title">电子邮件</td>
						<td class="td_title">办公电话</td>
						<td class="td_title">移动电话</td>
					</tr>
					<c:forEach items="${datalist}" var="obj">
						<tr>
							<td><input type="checkbox" name="ids"  value="${obj.userId},${obj.userName}"  onclick="onckSelectUser(this)"/></td>
							<td>${obj.userId}</td>
							<td>${obj.userName}</td>
							<td>${obj.groupSign}</td>
							<td>${obj.email}</td>
							<td>${obj.officeTel}</td>
							<td>${obj.mobileTelephone}</td>
						</tr>
					</c:forEach>
				</table>
				<w:spPage />
			</div>
			</div>
		</form>
	</body>
</html>